package routes

import (
	"gitee.com/zxk7516/laral/models"
	"github.com/astaxie/beego"
	"github.com/astaxie/beego/orm"
	"golang.org/x/crypto/bcrypt"
	"time"
)

type RegisterController struct {
	beego.Controller
}

func (this *RegisterController) Get() {
	user := models.User{}
	user.Name = "zxk7516"
	user.Email = "zxk7516@foxmail.com"
	hash, _ := bcrypt.GenerateFromPassword([]byte("111111"), 10)
	user.Password = string(hash)
	user.EmailVerifiedAt = time.Now()
	user.CreatedAt = time.Now()
	user.UpdatedAt = time.Now()

	o := orm.NewOrm()
	o.Insert(&user)

	this.TplName = "auth/register.html"
}
